import { eventBus } from "../store/store.js";

const cur = {
    // props:["currentList"],
    computed: {
        currentList() {
            return eventBus.currentList
        }
    },
    template: `
    <div>
            
            <div class="order-detail flex mtb10">
                <p>商品名称</p>
                <p>数量</p>
                <p>价格</p>
                <p>操作</p>
            </div>
            <div class="order flex mtb10 bgc" v-for="(item,index) in currentList">
                <p>{{item.text}}</p>
                <p>{{item.nums}}</p>
                <p>{{item.price}}</p>
                <div>
                    <button @click="addClick(index)"> + </button>
                    <button @click="subClick(index)"> -- </button>
                    <button @click="delClick(index)">删除</button>
                </div>
            </div>
            
     </div>
    `,
    // data() {
    //     return {
    //          // 控制切换订单区的组件    0=current-order 1=pending-order  2=paid  3=cancelled-order
    //          orderFlag:0,
    //     }
    // },
    methods: {
        addClick(index) {
            console.log();
            eventBus.$emit("add",index)
        },
        subClick(index) {
            eventBus.$emit("sub",index)         
        },
        delClick(index) {
            eventBus.$emit("del",index)           
        }
    },
}
export default cur